/*
 *    Copyright (c) 2018-2025, shenghua All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: shenghua
 */

package com.chen.base.module.excel.handler;

import com.chen.base.module.excel.exception.ExcelMaxTotalRowsException;

import java.util.List;

/**
 * @author 陈锦龙
 * @since 2022/7/18 9:21
 */
public interface ExcelDataHandle<T> {

	/**
	 * 批量处理阈值
	 * @return 阈值数
	 */
	int getBatchCount();

	/**
	 * 最大总行数, {@link ExcelMaxTotalRowsException} 超过则抛出ExcelMaxTotalRowsException异常
	 * todo -1 表示不限制
	 * @return 最大总行数
	 */
	int maxTotalRows();

	/**
	 * 读取excel数据后，用于保存数据的方法
	 * @param list 需要入库的数据集，注：处理完后记住clear()
	 * @param totalRowNumber 总行数
	 */
	void dataHandler(List<T> list, Integer totalRowNumber);
}
